The present invention relates to a data processing system with a condition data setting function, which system determines the processing content of an operation, in accordance with condition data consisting of a combination of bits respectively representing the sign of a difference result obtained in each of a plurality of subtraction operations.
A graphic display apparatus having a monitor of a raster scan type is one such data processing system. In such a graphic display apparatus, a Bresenham DDA (Digital Differential Analyzer) is generally used to generate a line. In a Bresenham DDA, coordinates (line coordinates) of each lattice point (display dot) approximating a line (line segment) connecting a start point P.sub.0 (x.sub.0,y.sub.0) and an end point P.sub.1 (x.sub.1,y.sub.1) are generated in the following manner. According to the Bresenham DDA, the coordinate on the long axis (x or y-axis) is normally incremented or decremented by one (one dot or lattice point). Upon such an increase or decrease in the coordinate on the long axis, the absolute value of the slope of a line, with respect to the long axis, is added to a discrimination equation D. In contrast to this, the coordinate along the short axis (y or x-axis) is only incremented or decremented by one when D&gt;1/2. Note that the initial value of the discrimination equation D is 0. When D.gtoreq.1, the value of the equation D is decremented by one, and a difference (D-1) is used as the updated equation D.
The Bresenham DDA has eight line (line coordinate) generating functions. Which one of the eight line generating functions is to be used is determined in accordance with a combination of signs (positive (including zero) and negative values) of y.sub.1 -y.sub.0 (=.DELTA.y), x.sub.1 -x.sub.0 (=.DELTA.x), and .vertline.x.sub.1 -x.sub.0 .vertline.-.vertline.y.sub.1 -y.sub.0 .vertline.(=S) associated with a line connecting a start point P.sub.0 (x.sub.0,y.sub.0) and an end point P.sub.1 (x.sub.1,y.sub.1). The total number of sign combinations of the is eight. Lines adopted in the Bresenham DDA are thus classified into eight types I to VIII. FIG. 1 shows examples of lines of these eight types I to VIII. Whether .DELTA.y, .DELTA.x and S of each type are positive or negative is shown in the following table 1.
TABLE 2 ______________________________________ Direction X-coordi- Y-coordi- Discrimi- nate Gen- nate Gen- nation Long Short erating erating Code Type Axis Axis Direction Direction C2 C1 C0 ______________________________________ I X-axis Y-axis Positive Positive 0 0 0 II Y-axis X-axis Positive Positive 1 0 0 III Y-axis X-axis Negative Positive 1 1 0 IV X-axis Y-axis Negative Positive 0 1 0 V X-axis Y-axis Negative Negative 0 1 1 VI Y-axis X-axis Negative Negative 1 1 1 VII Y-axis X-axis Positive Negative 1 0 1 VIII X-axis Y-axis Positive Negative 0 0 1 ______________________________________ C2 = 0: long axis = xaxis C2 = 1: long axis = yaxis C1 = 0: positive xcoordinate generating direction C1 = 1: negative xcoordinate generating direction C0 = 0: positive ycoordinate generating direction C0 = 1: negative ycoordinate generating direction
In the case of a line having a positive (including zero) value of S, the x-axis is assigned as the long axis, and the y-axis is assigned as the short axis. In the case of a line having a negative value of S, the y-axis is assigned as the long axis, and the x-axis is assigned as the short axis. With this assignment of long and short axes, the slope of a line with respect to the long axis can be rendered to fall below 45.degree. in any line of the eight types I to VIII. As is well known, the slope of a line with respect to the long axis falling below 45.degree. is the fundamental condition for generating a line in a Bresenham DDA.
In a Bresenham DDA, whether the x-coordinate is to be incremented or decremented by one is determined by the sign of .DELTA.x. Whether the y-coordinate is to be incremented or decremented by one is determined by the sign of .DELTA.y. This amounts to saying that in a Bresenham DDA the generating directions (positive or negative direction) of the x and y-coordinates are determined by signs of .DELTA.x and .DELTA.y, respectively.
In a graphic display apparatus adopting a Bresenham DDA, logic bits C2, C1 and C0 are set, which respectively indicate the positive (including zero) or negative value of S, .DELTA.x and .DELTA.y. The 3-bit data consisting of bits C2, C1 and C0 indicates to which one of the eight types I to VIII the line belongs. The 3-bit data are called direction discrimination code. Bit C2 represents the fact that C2="0" and, for example, that S.gtoreq.0, i.e., that the x-axis is assigned as the long axis. Bit C2 also represents the fact that C2="1" and S&lt;0, i.e., the y-axis is assigned as the long axis. Bit C1 represents the fact that C1="0" and, for example, that .DELTA.x.gtoreq.0, i.e., that the generating direction of the x-coordinate is positive. Bit C1 also represents the fact that C1="1" and .DELTA.x&lt;0, i.e, that the generating direction of the x-coordinate is negative. Bit C0 represents the fact that C0="0" and, for example, that .DELTA. y.gtoreq.0, i.e., that the generating direction of the y-coordinate is positive. Bit C0 also represents the fact that C0="1" and .DELTA.y&lt;0, i.e., that the generating direction of the y-coordinate is negative. These relationships are shown in Table 2, below.
TABLE 2 ______________________________________ Direction X-coordi- Y-coordi- Discrimi- nate Gen- nate Gen- nation Long Short erating erating Code Type Axis Axis Direction Direction C2 C1 C0 ______________________________________ I X-axis Y-axis Positive Positive 0 0 0 II Y-axis X-axis Positive Positive 1 0 0 III Y-axis X-axis Negative Positive 1 1 0 IV X-axis Y-axis Negative Positive 0 1 0 V X-axis Y-axis Negative Negative 0 1 1 VI Y-axis X-axis Negative Negative 1 1 1 VII Y-axis X-axis Positive Negative 1 0 1 VIII X-axis Y-axis Positive Negative 0 0 1 ______________________________________ C2 = 0: long axis = xaxis C2 = 1: long axis = yaxis C1 = 0: positive xcoordinate generating direction C1 = 1: negative xcoordinate generating direction C0 = 0: positive ycoordinate generating direction C0 = 1: negative ycoordinate generating direction
In a Bresenham DDA, bits C2, C1 and C0 form a direction discrimination code. One of eight types of line generating functions is selected in accordance with this code. The processing content for generating a line is also determined in accordance with the direction discrimination code. Accordingly, the direction discrimination code is one type of condition data and generally obtained by software processing.
FIG. 2 is a flow chart of a conventional sequence for obtaining a direction discrimination code for a line connecting a start point P.sub.0 (x.sub.0,y.sub.0) and an end point P.sub.1 (x.sub.1,y.sub.1). As may be seen from FIG. 2, bits C2, C1 and C0 must be set to form a direction discrimination code. Conventionally, in order to determine a value Ci (where i=0, 1, 2), a number of steps are involved including a subtraction step (.DELTA.y.rarw.y.sub.1 -y.sub.0, .DELTA.x.rarw.x.sub.1 -x.sub.0, and S.rarw..vertline..DELTA.x.vertline.-.vertline..DELTA.y.vertline.), a conditional branch step for performing a conditional branch by determining the sign of the difference obtained in the subtraction step, and a Ci set step for setting the value Ci in accordance with the determination result obtained in the conditional branch step. For this reason, a conventional graphic display apparatus requires a long period of time for obtaining direction discrimination code and cannot generate lines at high speed. This problem is not limited to a graphic display apparatus, but is common to all data processing systems which determine the processing content in accordance with condition data comprising a combination of bits representing the sign of a difference obtained in each of a plurality of subtraction operations. To solve this problem, it is possible to use a hardware circuit for automatically setting condition data such as the direction discrimination code. However, since the addition of such a special circuit results in a higher cost of the overall system, it is impractical.